home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#43 (Apr 89)
/
Designer CDEF Code
/
HandleTheMenus.Pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-01-06
|
2KB
|
68 lines
UNIT HandleTheMenus;
INTERFACE
USES
AboutDialog, ExampleWindow, InitTheMenus;
PROCEDURE Handle_My_Menu (VAR doneFlag : boolean;
theMenu, theItem : integer); {Handle menu selection}
IMPLEMENTATION
PROCEDURE Handle_My_Menu; {Handle menu selections realtime}
CONST
L_Apple = 201; {Menu list}
C_About = 1;
L_File = 202; {Menu list}
C_Quit = 1;
VAR
DNA : integer; {For opening DAs}
BoolHolder : boolean; {For SystemEdit result}
DAName : Str255; {For getting DA name}
SavePort : GrafPtr; {Save current port when opening DAs}
BEGIN {Start of procedure}
CASE theMenu OF {Do selected menu list}
L_Apple :
BEGIN
CASE theItem OF {Handle all commands in this menu list}
C_About :
BEGIN
D_AboutDialog; {Call a dialog for this menu selection}
END;
OTHERWISE {Handle the DAs}
BEGIN {Start of Otherwise}
GetPort(SavePort); {Save the current port}
GetItem(AppleMenu, theItem, DAName); {Get the name of the DA selected}
DNA := OpenDeskAcc(DAName); {Open the DA selected}
SetPort(SavePort); {Restore to the saved port}
END; {End of Otherwise}
END; {End of item case}
END; {End for this list}
L_File :
BEGIN
CASE theItem OF {Handle all commands in this menu list}
C_Quit :
BEGIN
doneFlag := TRUE;
END;
OTHERWISE
;
END; {End of item case}
END; {End for this list}
OTHERWISE
;
END; {End for lists}
HiliteMenu(0); {Turn menu selection off}
END; {End of procedure Handle_My_Menu}
END. {End of unit}